package lv.dysnomia.portal.web

import com.google.appengine.api.datastore.Key
import com.google.appengine.api.users.User

import java.util.Date
import javax.jdo.annotations.{ IdentityType, IdGeneratorStrategy, PersistenceCapable, Persistent, PrimaryKey }

@PersistenceCapable(identityType = IdentityType.APPLICATION)
class Greeting {
  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  var key: Key = null

  @Persistent
  var author: User = null

  @Persistent
  var content: String = null

  @Persistent
  var date: Date = new Date

  def this(_author: User, _content: String, _date: Date) {
    this()
    author = _author
    content = _content
    date = _date
  }

  def getKey(): Key = {
    return key
  }

  def getAuthor():User = {
    return author
  }

  def getContent():String = {
    return content
  } 

  def getDate():Date = {
    return date
  }

  def setAuthor(_author:User):Unit = {
    author = _author
  }

 def setContent(_content:String):Unit = {
    content = _content
  }

  def setDate(_date:Date):Unit = {
    date = _date
  }

}